// Copyright (c) 2008, 
// Marc Speck, http://www.faindu.com
// All Rights Reserved. The following is Source Code and is subject to all restrictions 
// on such code as contained in the license accompanying this product.
package com.faindu.editImage.crop
{
import com.faindu.editImage.base.BaseCursor;
import com.faindu.editImage.base.BaseTool;

import mx.core.BitmapAsset;

/**
* The cursor shown when the user hovers over the control. 
*/
public class CropCursor extends BaseCursor
{
	/**
	 * Constructor
	 */
	public function CropCursor( referenceName:String ) 
	{
		var angleInDegrees:Number = 0

		switch ( referenceName )
		{
			case BaseTool.TOP_LEFT:
				angleInDegrees = 45
				offset_x = 25
				offset_y = 15				
				break;

			case BaseTool.TOP:
				angleInDegrees = 90
				offset_x = 15
				offset_y = 20				
				break;

			case BaseTool.TOP_RIGHT:
				angleInDegrees = +135
				offset_x = -5
				offset_y = 25
				break;

 			case BaseTool.RIGHT:
				angleInDegrees = 180
				offset_x = -10
				offset_y = 15
				break;

			case BaseTool.BOTTOM_RIGHT:
				angleInDegrees = -135
				offset_x = -20
				offset_y = 0
				break;

			case BaseTool.BOTTOM:
				angleInDegrees = -90
				offset_x = -10
				offset_y = -10
				break;

			case BaseTool.BOTTOM_LEFT:
				angleInDegrees = -45
				offset_x = 5
				offset_y = -15
				break;

			case BaseTool.LEFT:
				angleInDegrees = 0
				offset_x = 15
				offset_y = -05				
				break; 
		}
		
		var cursorBitmapAsset: BitmapAsset = BitmapAsset( new cursorRightClass() )
		cursorBitmapAsset.smoothing = true
		cursorBitmapAsset.rotation =  angleInDegrees
		addChild( cursorBitmapAsset )
	}

	[Bindable]
	[Embed(source='/com/faindu/editImage/assets/lc_arrowshapes.right-arrow.png')]
	private var cursorRightClass:Class;	
}
}